<?php
/*
Template Name: Single Post
*/
?>
<?php get_header(); ?>

<div id="padd-content">
	<div id="padd-content-wrapper">

<?php if (have_posts()) : ?>

<div class="padd-post-group padd-post-group-single">
	<div class="padd-post-list padd-post-list-single">
	<?php while (have_posts()) : ?>
		<?php the_post(); ?>
		<div class="padd-post-item padd-post-item-single" id="post-<?php the_ID(); ?>">
			<div class="padd-post-item-title">
				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
			</div>
			<div class="padd-post-item-entry">
				<?php the_content(); ?>
				<?php wp_link_pages(array('before' => '<p class="pages"><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
			</div>
			<?php
				$desc = get_the_author_meta('description');
				if (!empty($desc)) {
			?>
			<div class="padd-post-box padd-post-box-about-author">
				<div class="padd-post-box-title">
					<h3>About the Author</h3>
				</div>
				<div class="padd-post-box-interior">
					<?php echo get_avatar(get_the_author_meta('email'),53) ?>
					<p><?php echo $desc; ?></p>
					<div class="clearer"></div>
				</div>
			</div>
			<?php
				}
			?>


			<div class="padd-post-box padd-post-box-related">
				<div class="padd-post-box-title">
					<h3>Related News</h3>
				</div>
				<div class="padd-post-box-interior">
					<?php
						padd_related_posts(get_the_ID());
					?>
				</div>
			</div>
			<!--<?php comments_template('',true); ?> -->
		</div>
	<?php endwhile; ?>
	</div>

</div>

<?php else : ?>

<div class="padd-post-group padd-post-group-result padd-post-group-error">
	<div class="padd-post-group-title">
		<h2>Not Found</h2>
	</div>
	<div class="padd-post-group-descr">
		<p>Sorry, but you are looking for a category that isn't here.</p>
	</div>
</div>

<?php endif; ?>

	</div>
</div>

<?php
	$id_post = get_the_ID();
	$post_categories = wp_get_post_categories( $id_post );

	foreach($post_categories as $c){
		$cat = get_category( $c );
		if($cat->category_parent==14){
			$parent_s2 = true;
		};
	}

	if(($parent_s2) or in_category('s2') ){
		get_sidebar(s2);
	}
	else {
		get_sidebar();

	}

?>

<div class="padd-clear"></div>

<?php get_footer(); ?>
